// 全局共享数据示例
import { useState } from 'react';

const useUser = () => {
  const [userInfo, setUserInfo] = useState({});
  const getInfo = async () => {
    const res: any = await new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({
          name: 'zhangsan',
          age: 18,
        });
      }, 1000);
    });
    setUserInfo(res);
  };

  return {
    userInfo,
    setUserInfo,
    getInfo,
  };
};

export default useUser;
